home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
A.D. Software
/
OOFGraph
/
Application Source
/
CDashboardApp.cp
< prev
next >
Wrap
Text File
|
1996-04-30
|
4KB
|
156 lines
// ===========================================================================
// CDashboardApp.cp ©1994 Metrowerks Inc. All rights reserved.
// ===========================================================================
//
// A "do nothing" Dashboard program that you can use as a starter for
// you own programs.
#include "CDashboardApp.h"
#include <LApplication.h>
#include <LGrowZone.h>
#include <LWindow.h>
#include <UDrawingState.h>
#include <UMemoryMgr.h>
#include <URegistrar.h>
#include "CPlotPane.h"
#ifdef OOF_SmartHeap
#include "smrtheap.hpp"
#endif
const ResIDT WIND_Dashboard = 200;
// ===========================================================================
// • Main Program
// ===========================================================================
void main()
{
// Set Debugging options
SetDebugThrow_(debugAction_Alert);
SetDebugSignal_(debugAction_Alert);
InitializeHeap(3); // Initialize Memory Manager
// Parameter is number of Master Pointer
// blocks to allocate
// Initialize standard Toolbox managers
UQDGlobals::InitializeToolbox(&qd);
new LGrowZone(20000); // Install a GrowZone function to catch
// low memory situations.
// Parameter is size of reserve memory
// block to allocated. The first time
// the GrowZone function is called,
// there will be at least this much
// memory left (so you'll have enough
// memory to alert the user or finish
// what you are doing).
CDashboardApp theApp; // Create instance of your Application
theApp.Run(); // class and run it
}
// ===========================================================================
// • CDashboardApp Class
// ===========================================================================
// ---------------------------------------------------------------------------
// • CDashboardApp
// ---------------------------------------------------------------------------
// Constructor
CDashboardApp::CDashboardApp()
{
// Do the PPob Stuff
URegistrar::RegisterClass(LWindow::class_ID, (ClassCreatorFunc)LWindow::CreateWindowStream);
URegistrar::RegisterClass(CPlotPane::class_ID,(ClassCreatorFunc)CPlotPane::CreatePlotPaneStream);
// A Dashboard program has a single main Window that is
// displayed on start up. The "Visible on Creation" option
// for the Window (in its PPob resource) should be OFF,
// so that you can adjust the Window's contents before
// displaying it.
mDisplayWindow = LWindow::CreateWindow(WIND_Dashboard, this);
// +++ Add code here to configure Panes inside the Window
mDisplayWindow->Show();
}
// ---------------------------------------------------------------------------
// • ~CDashboardApp
// ---------------------------------------------------------------------------
// Destructor
CDashboardApp::~CDashboardApp()
{
// +++ Add code here to cleanup (if necessary) before quitting
}
// ---------------------------------------------------------------------------
// • ObeyCommand
// ---------------------------------------------------------------------------
// Respond to commands
Boolean
CDashboardApp::ObeyCommand(
CommandT inCommand,
void *ioParam)
{
Boolean cmdHandled = true;
switch (inCommand) {
// +++ Add cases here for the commands you handle
// Remember to add same cases to FindCommandStatus below
// to enable/disable the menu items for the commands
default:
cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
break;
}
return cmdHandled;
}
// ---------------------------------------------------------------------------
// • FindCommandStatus
// ---------------------------------------------------------------------------
// Pass back status of a (menu) command
void
CDashboardApp::FindCommandStatus(
CommandT inCommand,
Boolean &outEnabled,
Boolean &outUsesMark,
Char16 &outMark,
Str255 outName)
{
switch (inCommand) {
// +++ Add cases here for the commands you handle.
//
// Set outEnabled to TRUE for commands that can be executed at
// this time.
//
// If the associated menu items can have check marks, set
// outUsesMark and outMark accordingly.
//
// Set outName to change the name of the menu item
default:
LApplication::FindCommandStatus(inCommand, outEnabled, outUsesMark,
outMark, outName);
break;
}
}